package com.highper.application.service.remote.fallback;

import com.highper.application.service.remote.IAdminRemoteService;
import com.highper.common.constant.ExceptionMessageConstant;
import com.highper.common.constant.ResponseCodeConstant;
import com.highper.common.constant.ServiceNameConstant;
import com.highper.common.entity.exception.HighperFeignException;
import feign.hystrix.FallbackFactory;

/**
 * @Author ZhangGJ
 * @Date 2022/02/07 10:02
 */
public class AdminRemoteServiceFallback implements FallbackFactory<IAdminRemoteService> {

    @Override
    public IAdminRemoteService create(Throwable throwable) {
        String message = String.format(ExceptionMessageConstant.FEIGN_ERROR_INFO, ServiceNameConstant.HIGHPER_ADMIN);
        throw new HighperFeignException(ResponseCodeConstant.CALL_FEIGN_ERROR, message);
    }

}
